<!--
 * @Author: 卡卡 1071780426@qq.com
 * @Date: 2022-11-05 09:34:27
 * @LastEditors: 卡卡 1071780426@qq.com
 * @LastEditTime: 2023-03-10 17:28:55
 * @FilePath: \mould\src\components\public\el-tree.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->


<template>
    <!-- current-node-key -->
    <!-- ['0fea35c0-6fd2-4825-936d-cff9c00aab38', 'ae54000f-d1b5-4e30-affc-d7533490ba71', 'a3f676d3-d557-4864-9aa2-d452a2dbc85a'] -->
    <el-tree :data="treeData" :props="defaultProps" :highlight-current="highlightBd" @node-click="handleNodeClick"
        node-key="fCompanyid" :accordion="true" :expand-on-click-node="false" :default-checked-keys="checkData"
        :default-expanded-keys="checkData" :current-node-key="checkData[0]"></el-tree>
</template>
<script>
export default {
    props: {
        treeData: {
            type: Array,
            default: () => []
        },
        checkData: {
            type: Array,
            default: () => []
        },
        defaultProps: {
            type: Object,
            default: () => { }
        },
        nodeKey: {
            type: String,
            default: "fCompanyid"
        },
        name: {
            type: String,
            default: ""
        }

        // dataList: {
        //     type: Array,
        //     default: () => {
        //         return []
        //     }
        // },
        // loading: {
        //     type: Boolean,
        //     default: false
        // }
    },
    data() {
        return {
            // treeData: [],
            // 左侧机构树
            // defaultProps: {
            //     children: "children",
            //     label: "fShortname",
            // },
            highlightBd: true, //左侧机构树停留背景色
        }
    },
    watch: {
        fileDetail: {
            handler(newVal) {
                // console.log(newVal);
                if (newVal) {
                    this.pdfUrl = newVal.url;
                    this.fFileName = newVal.fFileName;
                }
            },
            immediate: true
        },

    },
    mounted() {



    },
    methods: {
        handleNodeClick(data) {
            // console.log(data);
            window.sessionStorage.setItem(
                this.name,
                JSON.stringify(data)
            );
            this.$emit('getTreeInfo', data)
            // @aa="dd"
            // if (this.checked == true) {
            //     this.getList.sublevel = 1;
            // } else {
            //     this.getList.sublevel = 0;
            // }
            // this.name = data.fShortname;
            // this.getList.fCompanyid = data.fCompanyid;
            // this.getDataList(this.getList);
        },
    }
}
</script>
<style scoped>
.tree {
    height: 100%;
}
</style>
